package com.atguigu.eduservice.controller;


import com.atguigu.commonutils.R;
import com.atguigu.eduservice.service.EduSubjectService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2021-07-01
 */
@Api(description="课程分类管理")
@RestController
@RequestMapping("/eduservice/subject")
@CrossOrigin//跨域 跨域问题：协议、地址、端口
//nginx反向代理   http://localhost:8001/eduservice/edu-teacher
public class EduSubjectController {

    @Resource
    private EduSubjectService subjectService;
    //測試要把表里面的数据全部删除 之后再用qkjia.xlsm 测试
    @ApiOperation(value = "批量导入课程分")
    @PostMapping("/addSubject")
    @ApiOperationSupport(author = "zqk", order = 1)
    public R addSubject(MultipartFile file) {
        //1 获取上传的excel文件 MultipartFile
        //返回错误提示信息
        subjectService.addSubject(file,subjectService);
        //判断返回集合是否为空
        return R.ok();
    }

}

